﻿//Copyright 2011 University of Southampton 
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using System.ComponentModel;

namespace SharePointEntityProject.EntityEditorLib
{
    public class FieldInfo
    {
        // Fields...
        private string _MetadataSetDescription;
        private string _MetadataSetName;
        private string _Id;
        private string _Group;
        private string _Type;
        private string _TypeStr;
        private string _Description;
        private string _Name;


        public string MetadataSetDescription
        {
            get { return _MetadataSetDescription; }
            set
            {
                _MetadataSetDescription = value;
            }
        }


        public string MetadataSetName
        {
            get { return _MetadataSetName; }
            set
            {
                _MetadataSetName = value;
            }
        }


        public override string ToString()
        {
            return this.Name;
        }

        public string Group
        {
            get { return _Group; }
            set
            {
                _Group = value;
            }
        }

        public string Description
        {
            get { return _Description; }
            set
            {
                _Description = value;
            }
        }

        public string Name
        {
            get { return _Name; }
            set
            {
                _Name = value;
            }
        }

        [DataObjectField(false)]
        public string Id
        {
            get { return _Id; }
            set
            {
                _Id = value;
            }
        }


        public string Type
        {
            get { return _Type; }
            set
            {
                _Type = value;
            }
        }


        public FieldInfo()
        {

        }

        
    }

    internal class ContentTypeInfo
    {
        // Fields...
        private string _ID;
        private string _Description;
        private string _Title;

        public override string ToString()
        {
            return this.Name;
        }

        public string Name
        {
            get { return _Title; }
            set
            {
                _Title = value;
            }
        }


        public string Description
        {
            get
            {
                return _Description;
            }
            set
            {
                _Description = value;
            }
        }



        public string Id
        {
            get { return _ID; }
            set
            {
                _ID = value;
            }
        }


        /// <summary>
        /// Convert SP object into display object
        /// </summary>
        /// <param name="spContentType"></param>
        internal ContentTypeInfo(SPContentType spContentType)
        {
            this.Name = spContentType.Name;
            this.Description = spContentType.Description;
            this.Id = spContentType.Id.ToString();

        }
    }
}
